package model

type ReplyStatType string

const (
	ReplyStatLikes    ReplyStatType = "likes"
	ReplyStatShares   ReplyStatType = "shares"
	ReplyStatComments ReplyStatType = "comments"
)

// swagger:model Posts
// 帖子,只存储帖子相关内容,用户的内容可以带上
// ToRid为-1为帖子下一级评论
type Replys struct {
	AutoId          `xorm:"extends"`
	UId             `xorm:"extends"`
	TimeModel       `xorm:"extends"`
	ReplyModifiable `xorm:"extends"`
	ReplyCreatable  `xorm:"extends"`

	// 评论状态,1为可见, 2为隐藏(删除)
	SeeStatus int64 `json:"see_status" xorm:"see_status not null default 0 int"`
	// 底下评论数量
	Count int64 `json:"count" xorm:"count not null default 0 int"`
	// 点赞数
	Shares   int64 `json:"shares" xorm:"shares not null default 0 int"`
	Likes    int64 `json:"likes" xorm:"likes not null default 0 int"`
	Comments int64 `json:"comments" xorm:"comments not null default 0 int"`
}

type ReplyModifiable struct {
	// 标题
	Title string `json:"title" xorm:"title not null default '' varchar(512)"`
}
type ReplyCreatable struct {
	// 最上层回复,-1如果是帖子的话,方便查询
	ToTopReplyId int64 `json:"to_top_reply_id" xorm:"to_top_reply_id not null bigint index default 0 BIGINT"`

	// 直接回复的回复id
	ToDirectReplyId int64 `json:"to_direct_reply_id" xorm:"to_direct_reply_id not null bigint default 0 BIGINT"`
	// 直接回复的用户
	ToUserId int64 `json:"to_user_id" xorm:"to_user_id not null bigint default 0 BIGINT"`
	// 回复的postId,区分是哪个帖子
	ToPostId int64 `json:"to_post_id" xorm:"to_post_id not null bigint default 0 BIGINT"`
}

const (
	// 一级评论,直接回复帖子
	ReplyToPost int64 = -1
)

// reply状态
const (
	_ int64 = iota
	Reply_See_EveryBody
	Reply_See_Hide
)

func NewDefaultReply() Replys {
	return Replys{
		SeeStatus: Reply_See_EveryBody,
	}
}
